/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.dream.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author syl
* @date 2020-07-19
**/
@Entity
@Data
@Table(name="sys_task_work")
public class TaskWork implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "编号")
    private Integer id;

    @Column(name = "name",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "任务名称")
    private String name;

    @Column(name = "item_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "项目名称")
    private Integer itemId;

    @Column(name = "corp_id")
    @ApiModelProperty(value = "所属公司")
    private Integer corpId;

    @Column(name = "status",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "是否完结")
    private String status;

    @Column(name = "start_date",nullable = false)
    @NotNull
    @ApiModelProperty(value = "任务开始日期")
    private Timestamp startDate;

    @Column(name = "actual_start_time")
    @ApiModelProperty(value = "任务实际开始日期")
    private Timestamp actualStartTime;

    @Column(name = "end_date",nullable = false)
    @NotNull
    @ApiModelProperty(value = "任务结束日期")
    private Timestamp endDate;

    @Column(name = "start_time")
    @ApiModelProperty(value = "任务开始时间具体到小时")
    private Timestamp startTime;

    @Column(name = "end_time")
    @ApiModelProperty(value = "任务结束时间具体到小时")
    private Timestamp endTime;

    @Column(name = "work_time",nullable = false)
    @NotNull
    @ApiModelProperty(value = "工作时长")
    private Double workTime;

    @Column(name = "work_content",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "工作内容")
    private String workContent;

    @Column(name = "task_user_id")
    @ApiModelProperty(value = "执行人")
    private Integer taskUserId;

    @Column(name = "task_status",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "任务状态")
    private String taskStatus;

    @Column(name = "create_time")
    @ApiModelProperty(value = "创建时间")
    private Timestamp createTime;

    @Column(name = "create_by")
    @ApiModelProperty(value = "创建人")
    private String createBy;

    @Column(name = "update_time")
    @ApiModelProperty(value = "更新时间")
    private Timestamp updateTime;

    @Column(name = "update_by")
    @ApiModelProperty(value = "更新人")
    private String updateBy;

    @Column(name = "remark")
    @ApiModelProperty(value = "备注")
    private String remark;

    public void copy(TaskWork source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}